home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kfontcombo.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-10  |  4.8 KB  |  180 lines

  1. /* This file is part of the KDE libraries
  2.    Copyright (c) 2001 Malte Starostik <malte@kde.org>
  3.  
  4.    This library is free software; you can redistribute it and/or
  5.    modify it under the terms of the GNU Library General Public
  6.    License version 2 as published by the Free Software Foundation.
  7.  
  8.    This library is distributed in the hope that it will be useful,
  9.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  10.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  11.    Library General Public License for more details.
  12.  
  13.    You should have received a copy of the GNU Library General Public License
  14.    along with this library; see the file COPYING.LIB.  If not, write to
  15.    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  16.    Boston, MA 02110-1301, USA.
  17. */
  18.  
  19. // $Id: kfontcombo.h 465272 2005-09-29 09:47:40Z mueller $
  20.  
  21. #ifndef _KFONTCOMBO_H_
  22. #define _KFONTCOMBO_H_
  23.  
  24. #include <kcombobox.h>
  25.  
  26. /**
  27.  * @short A combobox that lists the available fonts.
  28.  *
  29.  * The items are painted using the respective font itself, so the user
  30.  * can easily choose a font based on its look. This can be turned off
  31.  * globally if the user wishes so.
  32.  *
  33.  * @author Malte Starostik <malte@kde.org>
  34.  */
  35. class KDEUI_EXPORT KFontCombo : public KComboBox
  36. {
  37.     Q_OBJECT
  38.     Q_PROPERTY(QString family READ currentFont WRITE setCurrentFont)
  39.     Q_PROPERTY(bool bold READ bold WRITE setBold DESIGNABLE true)
  40.     Q_PROPERTY(bool italic READ italic WRITE setItalic DESIGNABLE true)
  41.     Q_PROPERTY(bool underline READ underline WRITE setUnderline DESIGNABLE true)
  42.     Q_PROPERTY(bool strikeOut READ strikeOut WRITE setStrikeOut DESIGNABLE true)
  43.     Q_PROPERTY(int fontSize READ size WRITE setSize DESIGNABLE true)
  44. public:
  45.     /**
  46.      * Constructor
  47.      *
  48.      * @param parent The parent widget
  49.      * @param name The object name for the widget
  50.      */
  51.     KFontCombo(QWidget *parent, const char *name = 0);
  52.     /**
  53.      * Constructor that takes an already initialzed font list
  54.      *
  55.      * @param fonts A list of fonts to show
  56.      * @param parent The parent widget
  57.      * @param name The object name for the widget
  58.      */
  59.     KFontCombo(const QStringList &fonts, QWidget *parent, const char *name = 0);
  60.     /**
  61.      * Destructor
  62.      */
  63.     virtual ~KFontCombo();
  64.  
  65.     /**
  66.      * Sets the font list.
  67.      *
  68.      * @param fonts Font list to show
  69.      */
  70.     void setFonts(const QStringList &fonts);
  71.     /**
  72.      * Sets the currently selected font.
  73.      *
  74.      * @param family Font to select.
  75.      */
  76.     void setCurrentFont(const QString &family);
  77.     /**
  78.      * @return the currently selected font.
  79.      */
  80.     QString currentFont() const;
  81.  
  82.     /**
  83.      * Sets the listed fonts to bold or normal.
  84.      *
  85.      * @param bold Set to true to display fonts in bold
  86.      */
  87.     void setBold(bool bold);
  88.     /**
  89.      * Returns the current bold status.
  90.      *
  91.      * @return true if fonts are bold
  92.      */
  93.     bool bold() const;
  94.     /**
  95.      * Sets the listed fonts to italic or regular.
  96.      *
  97.      * @param italic Set to true to display fonts italic
  98.      */
  99.     void setItalic(bool italic);
  100.     /**
  101.      * Returns the current italic status
  102.      *
  103.      * @return True if fonts are italic
  104.      */
  105.     bool italic() const;
  106.     /**
  107.      * Sets the listed fonts to underlined or not underlined
  108.      *
  109.      * @param underline Set to true to display fonts underlined
  110.      */
  111.     void setUnderline(bool underline);
  112.     /**
  113.      * Returns the current underline status
  114.      *
  115.      * @return True if fonts are underlined
  116.      */
  117.     bool underline() const;
  118.     /**
  119.      * Sets the listed fonts to striked out or not
  120.      *
  121.      * @param strikeOut Set to true to display fonts striked out
  122.      */
  123.     void setStrikeOut(bool strikeOut);
  124.     /**
  125.      * Returns the current strike out status
  126.      *
  127.      * @return True if fonts are striked out
  128.      */
  129.     bool strikeOut() const;
  130.     /**
  131.      * Sets the listed fonts' size
  132.      *
  133.      * @param size Set to the point size to display the fonts in
  134.      */
  135.     void setSize(int size);
  136.     /**
  137.      * Returns the current font size
  138.      *
  139.      * @return The point size of the fonts
  140.      */
  141.     int size() const;
  142.  
  143.     /**
  144.      * Returns the user's setting of whether the items should be painted
  145.      * in the respective fonts or not
  146.      *
  147.      * @return True if the respective fonts are used for painting
  148.      */
  149.     static bool displayFonts();
  150.  
  151.     virtual void setCurrentItem(int i);
  152.  
  153. protected slots:
  154.     /**
  155.      * @internal
  156.      * Listens to highlighted(int)
  157.      */
  158.     void slotModified( int i );
  159.  
  160. protected:
  161.     /**
  162.      * Updated the combo's listBox() to reflect changes made to the
  163.      * fonts' attributed
  164.      */
  165.     void updateFonts();
  166.  
  167. private:
  168.     void init();
  169.  
  170. private:
  171.     friend class KFontListItem;
  172. protected:
  173.     virtual void virtual_hook( int id, void* data );
  174. private:
  175.     struct KFontComboPrivate *d;
  176. };
  177.  
  178. #endif
  179.  
  180.